﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using IBLL;
using MedicalSystem.Models;
using Microsoft.AspNetCore.Mvc;
using Model;
using Model.ShowViewPayment;

namespace MedicalSystem.Controllers
{
    public class PaymentController : Controller
    {
        MyDBContext db = new MyDBContext();
        IPaymentBLL _bll;
        public PaymentController(IPaymentBLL bll)
        {
            _bll = bll;
        }
        public IActionResult Index()
        {
            return View();
        }
        //新增页面
        public IActionResult AddPayment()
        {
            return View();
        }
        //发票
        public IActionResult FaPiao()
        {
            return View();
        }
        //支付查询视图
        public IActionResult ShowPayment()
        {
            return View();
        }
        //支付查询方法
        [HttpGet]
        public List<ShowPaymentView> GetPayment(string name)
        {
            return _bll.GetPayment(name);
        }
        //新增支付
        [HttpPost]
        public JsonResult AddPaymentin(Payment p)
        {
            return Json(_bll.AddPayment(p));
        }
        //绑定病人编号下拉框
        [HttpGet]
        public List<Patient> BindPatient()
        {
            return _bll.BindPatient();
        }
        //根据患者编号反填
        [HttpGet]
        public List<FanTianView> FanTian(int fid)
        {
            return _bll.FanTian(fid);
        }
        /// <summary>
        /// 绑定优惠方式
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<Discount> BangDiscount()
        {
            var list= _bll.BangDiscount();
            return list;
        }
        /// <summary>
        /// 绑定支付类型
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<ChargeType> BangChargeType()
        {
            return _bll.BangChargeType();
        }
    }
}
